package cn.hchaojie.boot.web;

import java.io.File;
import java.io.IOException;
import java.util.Date;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

// @Controller
@RestController
public class ArchiveController {
	
	@RequestMapping("/hello")
	public String hello() {
		return "你好！";
	}
	
	@RequestMapping("/date")
	public String demoDate(@RequestParam("date") Date date) {
		System.out.println(date);
		return "success";
	}
	
	@RequestMapping("/upload")
	public String upload(@RequestParam("excel") MultipartFile file) throws IllegalStateException, IOException {
		System.out.println(file.getOriginalFilename());
		file.transferTo(new File("D:\\" + file.getOriginalFilename()));
		return "success";
	}
}
